package com.snow.campuslink.user.controller;

import com.snow.campuslink.project.result.Result;
import com.snow.campuslink.user.entity.UserFocus;
import com.snow.campuslink.user.service.IUserFocusService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Gaosl
 * @since 2021-03-02
 */
@RestController
@RequestMapping("/user/user-focus")
public class UserFocusController {

    @Resource
    IUserFocusService userFocusService;

    @ApiOperation(value = "")
    @PostMapping("saveFocus")
    public Result saveFocus(@RequestBody UserFocus userFocus){
        userFocusService.save(userFocus);
        return Result.success();
    }

    @ApiOperation(value = "")
    @GetMapping("getFocus")
    public Result getFocus(@RequestBody UserFocus userFocus){
       List<UserFocus> list= userFocusService.getFocus(userFocus);
        return Result.success().data(list);
    }

    @ApiOperation("")
    @DeleteMapping("deleteFocus/{focusId}")
    public Result removeById (@PathVariable("focusId") Long focusId){
        userFocusService.removeById(focusId);
        return Result.success();
    }
}

